package com.favccxx.message.domain.message.entity.router;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@Document(collection = "msg_router")
public class MessageRouter implements Serializable {

    @Id
    private String id;

    private String routerName;

    /**
     * 消息来源Id
     */
    private String fromEndPoint;

    /**
     * 消息格式
     * XML/JSON
     */
    private String messageFormat = "JSON";

    /**
     * 消息过滤器
     */
    private String filterInstance;

    /**
     * 消息预处理器，主要负责消息
     */
    private String preprocessor;

    /**
     * 消息预处理规则
     */
    private String preProcessRules;

    /**
     * 消息是否持久化处理，默认为false
     * 如果为true，则经过预处理后写入时序数据库
     */
    private boolean persistence = false;

    /**
     * 消息处理器
     */
    private String processor;

    /**
     * 消息处理规则
     */
    private String processRules;

    /**
     * 消息发送Id
     */
    private String toEndPoint;

    /**
     * 路由状态，默认启用
     */
    private boolean status;

    private LocalDateTime createTime;

    @LastModifiedDate
    private LocalDateTime updateTime;

}
